home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
os2
/
o2d011.zip
/
O2D.DOC
next >
Wrap
Text File
|
1992-11-14
|
7KB
|
177 lines
O2D Copyright (c) 1992 Bruce E. Högman. Ver 1.0
All Rights Reserved. 92-11-13
FUNCTION:
O2D is an OS/2 program that issues a DosStartSession call to start a
foreground fullscreen DOS session and to pass an ENVIRONMENT
constructed from a user-specified ASCII text file containing a list
of variables to SET. The invoked DOS session is a CHILD of the OS/2
parent session containing O2D. The new session requests foreground
execution, but OS/2 will not honor this unless the parent session is
currently in the foreground. The parent session waits for the new
session to terminate.
The intended use of this program is to allow an OS/2 program, .CMD
or REXX to invoke a DOS .BAT file and wait for its termination. A
specific application is to allow use of .BAT files common to both
OS/2 and DOS users of LAN services, for example.
The environment constructed is used only by the operating system DOS
session manager during its initialization of the target DOS session.
This processing supports setup of target DOS session with the same
functionality as provided by the launching of a DOS session from the
desktop where the DOS session is defined by a folder.
** NOTE:
To establish a DOS environment containing PATH and SET variables for
use by the target DOS application program, start a .BAT file instead
of a .EXE or .COM file as the target of the O2D program and use
appropriate SET commands in the .BAT file that setup the environment
variables for the target application.
Example of .BAT SET commands for BorlandC compiler:
SET INCLUDE=C:\BORLANDC\INCLUDE;C:\MYC\INCLUDE
SET LIB=C:\BORLANDC\LIB
PATH=C:\BORLANDC\BIN;%PATH%
Example of ASCII Environment File records: (shows all keys)
Only some of the keywords below are usually used:
DOS_BACKGROUND_EXECUTION=ON
DOS_BREAK=OFF
DOS_DEVICE= /* device.sys filename */
DOS_FCBS=16
DOS_FCBS_KEEP=8
DOS_FILES=20
DOS_HIGH=ON
DOS_LASTDRIVE=J
DOS_RMSIZE=640
DOS_SHELL=D:\OS2\MDOS\COMMAND.COM D:\OS2\MDOS /P
DOS_STARTUP_DRIVE= /* filespec for VMDISK DOS file */
DOS_UMB=ON
DOS_VERSION= /* special DOS settings required for app */
DPMI_DOS_API=ENABLED
DPMI_MEMORY_LIMIT=3
DPMI_NETWORK_BUFF_SIZE=8
EMS_FRAME_LOCATION=AUTO
EMS_HIGH_OS_MAP_REGION=32
EMS_LOW_OS_MAP_REGION=384
EMS_MEMORY_LIMIT=2048
HW_NOSOUND=OFF
HW_ROM_TO_RAM=OFF
HW_TIMER=OFF
IDLE_SECONDS=15
IDLE_SENSITIVITY=75
KBD_ALTHOME_BYPASS=OFF
KBD_BUFFER_EXTEND=ON
KBD_CTRL_BYPASS=OFF
KBD_RATE_LOCK=OFF
MEM_EXCLUDE_REGIONS=
MEM_INCLUDE_REGIONS=
MOUSE_EXCLUSIVE_ACCESS=OFF
PRINT_TIMEOUT=15
VIDEO_FASTPASTE=ON
VIDEO_MODE_RESTRICTION=NONE
VIDEO_ONDEMAND_MEMORY=ON
VIDEO_RETRACE_EMULATION=OFF
VIDEO_ROM_EMULATION=OFF
VIDEO_SWITCH_NOTIFICATION=ON
VIDEO_WINDOW_REFRESH=1
XMS_HANDLES=32
XMS_MEMORY_LIMIT=2048
XMS_MINIMUM_HMA=0
O2D provides support for the keywords in the DOS SESSION parameters
in the program folder, thus giving .CMD and REXX programs the same
DOS application features as provided by the program folder DOS
SESSION parameters.
CMD LINE:
O2D pgm_spec [/env:env_filespec] [/cd:cwd_spec] [target app cmd line]
O2D /? displays help information on syntax.
Example: (the next several lines would be entered as a single cmd)
O2D
d:\os2\apps\borlandc.bat d:\os2\apps\borlandc.ini
.... borlandc bc.exe cmd line parameters ...
PROCESSING LOGIC:
1. Process command line operands from left to right.
The first operand is the target program name or .bat file name.
The keyword operands are the /env: and /cwd: operands that
name the environment variable values file and the current
working directory.
The /cwd: operand is acted upon 1st if it is present. This
allows you to specify the program file/.bat file and the /env:
environment file name in relation to that /cwd: path. If an
error occurs in attempting to chdir to the target cwd, the
processing halts.
If a /cwd: operand is present, then O2D does a chdir to the
target directory. After O2D starts the DOS session, it will
return to the drive and directory current at the time it began
execution.
2. Verify the target program file or .bat file exists. Halt if
that file cannot be read.
3. Read & process env_spec file, constructing environment string to
pass to DosStartSession.
4. Issue DosStartSession call.
5. Wait for CHILD session to terminate using DosReadQueue to read
contents of termination queue defined prior to DosStartSession.
Note that the DosWaitChild function does not work for OS/2 to
DOS via DosStartSession. If the user did not specify /nowait,
this wait step is by-passed, and the invoked DOS session runs
as an independent session. If a wait is done, then the child
session is selected when the user selects O2D session from the
tasklist, and focus returns to O2D upon termination of the DOS
child session.
6. Restore the default drive and current directory for O2D that
was in effect when O2D started execution.
ENABLING EXTENDED HELP DISPLAY
If you copy the O2D.INF file to one of the directories in your
BOOKSHELF= path, you can tell O2D to display the extended
structured help file by issuing the command: O2D /? You can also
define a folder object in your Information folder that has:
Program: VIEW.EXE
Optional Parameters: O2D.INF
If you don't copy the O2D.INF file to a BOOKSHELF directory, then
you must specify the complete path to the O2D.INF file in the above
parameter value.
TECHNICAL NOTES:
The queue name used is \QUEUES\O2D\xxxx where xxxx is the thread
ordinal number for the current thread, which is unique in the system.
This permits multiple uses of O2D without any collisions in use
of queue names. The termination queue is used to provide
synchronization with the child session.
The usual DosWaitChild function does not support OS/2->DOS WAIT. The
usual use of DosWaitChild is in conjunction with DosExecPgm function.
However, DosExecPgm cannot be used to start a session of DOS type
from an OS/2 session, hence the use of DosStartSession with the
complex "wait" processing.
O2D issues DosReadQueue with wait, which does not return control to
itself until there is an entry in the termination queue.